package mysql

import "database/sql"

type SqlCommond struct {
	Sql_handle *sql.Stmt
	Sql_err error
}

func (self *SqlCommond) Excute(args ...interface{}) (sql.Result, error) {
	if self.Sql_err != nil{
		return nil,self.Sql_err
	}
	defer self.Sql_handle.Close()
	return self.Sql_handle.Exec(args...)
}

func (self *SqlCommond)QueryOne(args ...interface{}) (*sql.Row, error){
	if self.Sql_err != nil{
		return nil,self.Sql_err
	}
	defer self.Sql_handle.Close()
	return self.Sql_handle.QueryRow(args...),nil
}

func (self *SqlCommond)QueryMany(args ...interface{})(*sql.Rows, error){
	if self.Sql_err != nil{
		return nil,self.Sql_err
	}
	defer self.Sql_handle.Close()
	return self.Sql_handle.Query(args...)
}
